# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Maintainer: Josip Ponjavic <josipponjavic at gmail dot com>
# Contributor: Balló György <ballogyor+arch at gmail dot com>

pkgname=signon-ui
pkgver=0.17+20171022
pkgrel=3
_commit=4368bb77d9d1abc2978af514225ba4a42c29a646
pkgdesc='UI component responsible for handling the user interactions which can happen during the login process of an online account'
arch=(loong64 x86_64)
url='https://launchpad.net/online-accounts-signon-ui'
license=(GPL)
depends=(libaccounts-qt signond libnotify)
makedepends=(qt5-declarative)
source=(https://gitlab.com/accounts-sso/signon-ui/-/archive/$_commit/$pkgname-$pkgver.tar.gz
        fake-user-agent.patch
        signon-ui-loong64-bad-fix.patch)
sha256sums=('4534b05d10e206d332bd91838af3411fdbfc897b604ba5843e7af76c1657f99b'
            '5eb7782c6472e51a8107a25324d1d30052bac5d8e9050907cd957c89568fa577'
            'ab79b1e4a67edeb6150e2cb592ec56c71c46a064a048cdb73ddd0533f96f09e0')
options=(debug)

prepare() {
  cd $pkgname-$_commit

  # Do not install tests
  sed -e 's|src \\|src|' -e '/tests/d' -i signon-ui.pro
  # Fake user ID to bypass Google blacklist
  patch -p1 -i ../fake-user-agent.patch
  patch -p1 -i $srcdir/signon-ui-loong64-bad-fix.patch
}

build() {
  cd $pkgname-$_commit

  qmake-qt5 PREFIX=/usr LIBDIR=/usr/lib
  make
}

package() {
  cd $pkgname-$_commit

  make INSTALL_ROOT="$pkgdir" install
}

